home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume4 / conquer3 / part06 < prev    next >
Encoding:
Internet Message Format  |  1988-06-16  |  56.9 KB

  1. Path: uunet!lll-winken!lll-tis!ames!ll-xn!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games
  2. From: games@tekred.TEK.COM
  3. Newsgroups: comp.sources.games
  4. Subject: v04i047:  conquer3 - middle earth multi-player game (V3), Part06/08
  5. Message-ID: <2656@tekred.TEK.COM>
  6. Date: 16 Jun 88 21:39:08 GMT
  7. Sender: billr@tekred.TEK.COM
  8. Lines: 2210
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted by: ihnp4!homxc!smile
  12. Comp.sources.games: Volume 4, Issue 47
  13. Archive-name: conquer3/Part06
  14.  
  15.  
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 6 (of 8)."
  24. # Contents:  data.h magic.c main.c
  25. # Wrapped by billr@saab on Thu Jun 16 09:40:01 1988
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f data.h -a "${1}" != "-c" ; then 
  28.   echo shar: Will not over-write existing file \"data.h\"
  29. else
  30. echo shar: Extracting \"data.h\" \(13697 characters\)
  31. sed "s/^X//" >data.h <<'END_OF_data.h'
  32. X/* conquer : Copyright (c) 1988 by Ed Barlow. */
  33. X
  34. X/*--------I DO BELIEVE IT IS NECESSARY TO ALTER THIS FILE-------------------*/
  35. X#define    FAIL    1        /* fail return to shell */
  36. X#define    SUCCESS    0        /* successful return to shell */
  37. X#define    BIG    500000000L    /* BIGGER THAN ANYTHING SHOULD BE */
  38. X
  39. X#include <curses.h>
  40. X/* sometimes curses.h defines TRUE ...but doesn't */
  41. X/* check if already defined */
  42. X#ifndef TRUE
  43. X#define    TRUE        1
  44. X#define    FALSE        0
  45. X#endif
  46. X
  47. X/* these defines are for types of magic */
  48. X#define    M_MIL        1
  49. X#define    M_CIV        2
  50. X#define    M_MGK        3
  51. X
  52. X/*simple contour map definitions*/
  53. X#define    WATER        (*(ele+0))
  54. X#define    PEAK        (*(ele+1))
  55. X#define    MOUNTAIN    (*(ele+2))
  56. X#define    HILL        (*(ele+3))
  57. X#define    CLEAR        (*(ele+4))
  58. X
  59. X/*racial types*/
  60. X#define    GOD        '-'
  61. X#define    ORC        'O'
  62. X#define    ELF        'E'
  63. X#define    DWARF        'D'
  64. X#define    LIZARD        'L'
  65. X#define    HUMAN        'H'
  66. X#define    PIRATE        'P'
  67. X#define    BARBARIAN    'B'
  68. X#define    NOMAD        'N'
  69. X#define    TUNKNOWN    '?'
  70. X
  71. X/*designations*/
  72. X#ifdef 1
  73. X#define    DCITY        't'
  74. X#define    DCAPITOL    'c'
  75. X#define    DMINE        'm'
  76. X#define    DFARM        'f'
  77. X#define    DDEVASTATED    'x'
  78. X#define    DGOLDMINE    '$'
  79. X#define    DCASTLE        '!'
  80. X#define    DNODESIG    '-'
  81. X#else
  82. X#define    DCITY        (*(des+0))
  83. X#define    DCAPITOL    (*(des+1))
  84. X#define    DMINE        (*(des+2))
  85. X#define    DFARM        (*(des+3))
  86. X#define    DDEVASTATED    (*(des+4))
  87. X#define    DGOLDMINE    (*(des+5))
  88. X#define    DCASTLE        (*(des+6))
  89. X#define    DNODESIG    (*(des+7))
  90. X#endif
  91. X
  92. X/* nation placement variables */
  93. X#define    GREAT        'G'
  94. X#define    FAIR        'F'
  95. X#define    RANDOM        'R'
  96. X#define    OOPS        'X'
  97. X
  98. X/*vegetation types -- these are legal in designations too*/
  99. X#define    VOLCANO        (*(veg+0))
  100. X#define    DESERT        (*(veg+1))
  101. X#define    TUNDRA        (*(veg+2))
  102. X#define    BARREN        (*(veg+3))
  103. X#define    LT_VEG        (*(veg+4))
  104. X#define    GOOD        (*(veg+5))
  105. X#define    WOOD        (*(veg+6))
  106. X#define    FOREST        (*(veg+7))
  107. X#define    JUNGLE        (*(veg+8))
  108. X#define    SWAMP        (*(veg+9))
  109. X#define    ICE        (*(veg+10))
  110. X#define    NONE        (*(veg+11))
  111. X
  112. X/*Diplomacy Variables*/
  113. X#define    JIHAD        7
  114. X#define    WAR        6
  115. X#define    HOSTILE        5
  116. X#define    NEUTRAL        4
  117. X#define    FRIENDLY    3
  118. X#define    ALLIED        2
  119. X#define    CONFEDERACY    1
  120. X#define    UNMET        0
  121. X
  122. X/*army status*/
  123. X#define    MARCH        1    /*March */
  124. X#define    SCOUT        2    /*Scouting--will not engage enemy if possible*/
  125. X#define    ATTACK        3    /*Attack anybody (Hostile+) within 2 sectors*/
  126. X#define    DEFEND        4    /*Defend */
  127. X#define    GARRISON    5    /*Garrison--for a city or Capitol */
  128. X
  129. Xstruct s_sector
  130. X{
  131. X    char    designation;    /*designation of sector*/
  132. X    char    altitude;    /*sector altitude */
  133. X    char    vegetation;    /*sector vegetation    */
  134. X    short    owner;        /*nation id of owner, MAXNTN+? is SPECIAL*/
  135. X    int    people;        /*civilians in sector*/
  136. X    short    i_people;    /* initial civilians in sector */
  137. X    unsigned char    gold;        /*gold production ability*/
  138. X    unsigned char    fortress;    /*fortification level (0 to 9)*/
  139. X    unsigned char    iron;        /*amount of iron produced by sector*/
  140. X};
  141. X#define    SOWN    sct[xcurs+xoffset][ycurs+yoffset].owner
  142. X#define    XREAL    (xcurs+xoffset)
  143. X#define    YREAL    (ycurs+yoffset)
  144. X
  145. X#define    SCREEN_X_SIZE    ( (COLS - 21) / 2 )
  146. X#define    SCREEN_Y_SIZE    ( LINES - 5 )
  147. X
  148. X#define    PASSLTH        7    /*one less than the characters in the password*/
  149. X#define    NAMELTH        9    /*one less than the characters in the name*/
  150. X#define    LEADERLTH    9    /*one less than the characters in the leader*/
  151. X
  152. Xstruct navy
  153. X{
  154. X    short warships;
  155. X    short merchant;
  156. X    short xloc;
  157. X    short yloc;
  158. X    short smove;
  159. X    short crew;
  160. X    short armynum;
  161. X};
  162. X
  163. X#define    A_MILITIA    0
  164. X#define    A_GOBLIN    1
  165. X#define    A_ORC        2
  166. X#define    A_INFANTRY    3
  167. X#define    A_SAILOR    4
  168. X#define    A_MARINES    5
  169. X#define    A_ARCHER    6
  170. X#define    A_URUK        7
  171. X#define    A_NINJA        8
  172. X#define    A_PHALANX    9
  173. X#define    A_OLOG        10
  174. X#define    A_LEGION    11
  175. X#define    A_DRAGOON    12
  176. X#define    A_MERCENARY    13
  177. X#define    A_TROLL        14
  178. X#define    A_ELITE        15
  179. X#define    A_LT_CAV    16
  180. X#define    A_CAVALRY    17
  181. X#define    A_CATAPULT    18
  182. X#define    A_SEIGE        19
  183. X#define    A_ROC        20
  184. X#define    A_KNIGHT    21
  185. X#define    A_GRIFFON    22
  186. X#define    A_ELEPHANT    23
  187. X#define    NOUNITTYPES    23    /*number of unit types*/
  188. X
  189. X#define    MINLEADER    124    /* min value of a leader -1*/
  190. X#define    A_LEADER    124
  191. X#define    MAXLEADER    124    /* max value for leader */
  192. X
  193. X#define    MINMONSTER    225    /* min value of a monster -1*/
  194. X#define    SPIRIT        225
  195. X#define    ASSASSIN    226
  196. X#define    DJINNI        227
  197. X#define    GARGOYLE    228
  198. X#define    WRAITH        229
  199. X#define    HERO        230
  200. X#define    CENTAUR        231
  201. X#define    GIANT        232
  202. X#define    SUPERHERO    233
  203. X#define    MUMMY        234
  204. X#define    ELEMENTAL    235
  205. X#define    MINOTAUR    236
  206. X#define    DEMON        237
  207. X#define    BALROG        238
  208. X#define    DRAGON        239
  209. X#define    MAXMONSTER    239
  210. X
  211. Xstruct army
  212. X{
  213. X    short unittyp;
  214. X    short xloc;
  215. X    short yloc;
  216. X    short smove;
  217. X    int sold;
  218. X    short stat;
  219. X};
  220. X
  221. Xstruct    nation        /* player nation stats */
  222. X{
  223. X    char    name[NAMELTH+1];/* name */
  224. X    char    passwd[PASSLTH+1];/* password */
  225. X    char    leader[LEADERLTH+1];/* leader title */
  226. X    char    race;        /* national race (integer--see header.h)*/
  227. X    short    class;        /* national class*/
  228. X    char    location;    /* location variable gfr */
  229. X    char    mark;        /* unique mark for nation*/
  230. X    short    capx;        /* Capitol x coord */
  231. X    short    capy;        /* Capitol y coord */
  232. X    short    active;        /* activity level of nation, not sure if
  233. X                i have used this variable consistently:
  234. X                1 if PC NATION,
  235. X                2+Aggressiveness if NPC,
  236. X                0 if inactive,
  237. X                999 to represents MONSTER (pirate...)*/
  238. X    short    aplus;        /* attack plus of all soldiers*/
  239. X    short    dplus;        /* attack plus of all soldiers*/
  240. X    short    maxmove;    /* maximum movement of soldiers*/
  241. X    short    repro;        /* reproduction rate of nation*/
  242. X    long    score;        /* score */
  243. X    long    tgold;        /* gold in treasury */
  244. X    long    jewels;        /* raw amount of gold in treasury */
  245. X    long    tmil;        /* total military */
  246. X    long    tciv;        /* total civilians */
  247. X    long    tiron;        /* total real iron in nation*/
  248. X    long    tfood;        /* total food in nation*/
  249. X    long    powers;
  250. X    short    spellpts;    /* spell points */
  251. X    short    tsctrs;        /* total number sectors */
  252. X    short    tships;        /* number warships */
  253. X    struct    army arm[MAXARM];
  254. X    struct    navy nvy[MAXNAVY];
  255. X    short    dstatus[MAXNTN+4];    /*diplomatic status*/
  256. X};
  257. X
  258. X#define    ATYPE    ntn[country].arm[armynum].unittyp
  259. X#define    AXLOC    ntn[country].arm[armynum].xloc
  260. X#define    AYLOC    ntn[country].arm[armynum].yloc
  261. X#define    AMOVE    ntn[country].arm[armynum].smove
  262. X#define    ASOLD    ntn[country].arm[armynum].sold
  263. X#define    ASTAT    ntn[country].arm[armynum].stat
  264. X#define    NWAR    ntn[country].nvy[nvynum].warships
  265. X#define    NMER    ntn[country].nvy[nvynum].merchant
  266. X#define    NCREW    ntn[country].nvy[nvynum].crew
  267. X#define    NXLOC    ntn[country].nvy[nvynum].xloc
  268. X#define    NYLOC    ntn[country].nvy[nvynum].yloc
  269. X#define    NMOVE    ntn[country].nvy[nvynum].smove
  270. X
  271. Xextern    struct s_sector    sct[MAPX][MAPY];
  272. Xextern    struct nation    ntn[MAXNTN+4];
  273. Xextern    short    movecost[MAPX][MAPY];
  274. X/*is sector occupied, if MAXNTN+1 2+ armies occupy*/
  275. Xextern    char    occ[ MAPX ][ MAPY ];
  276. X
  277. X#define    AORN        0
  278. X#define    ARMY        1
  279. X#define    NAVY        2
  280. X
  281. X#define    XASTAT        1
  282. X#define    XAMEN        2
  283. X#define    XALOC        4
  284. X#define    XNLOC        5
  285. X#define    XNASHP        6
  286. X#define    XECNAME        8
  287. X#define    XECPAS        9
  288. X#define EDSPL        10
  289. X#define    XSADES        11
  290. X#define    XSACIV        12
  291. X#define    XSIFORT        13
  292. X#define    XNAGOLD        14
  293. X#define    XAMOV        15
  294. X#define    XNMOV        16
  295. X#define    XSAOWN        17
  296. X#define    EDADJ        18
  297. X#define    XNARGOLD    19
  298. X#define    XNAIRON        20
  299. X#define    INCAPLUS    22
  300. X#define    INCDPLUS    23
  301. X#define    CHG_MGK        24
  302. X#define    DESTRY        25
  303. X
  304. X#define    DESTROY fprintf(fexe,"DESTROY \t%d \t%d \t%hd \t0 \t0 \t%s\n",DESTRY,save,country,"null")
  305. X#define    CHGMGK fprintf(fexe,"L_MAGIC \t%d \t%hd \t%ld \t%ld \t0 \t%s\n",CHG_MGK,country,ntn[country].powers,x,"null")
  306. X#define    I_APLUS fprintf(fexe,"INC_APLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCAPLUS,country,"null")
  307. X#define    I_DPLUS fprintf(fexe,"INC_DPLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCDPLUS,country,"null")
  308. X#define    AADJSTAT fprintf(fexe,"A_STAT \t%d \t%hd \t%d \t%d \t0 \t%s\n",XASTAT,country,armynum,ntn[country].arm[armynum].stat,"null")
  309. X#define    AADJMEN    fprintf(fexe,"L_ADJMEN \t%d \t%hd \t%d \t%d \t%d \t%s\n",XAMEN ,country,armynum,ASOLD,ATYPE,"null")
  310. X#define    NADJSHP    fprintf(fexe,"N_ASHP \t%d \t%hd \t%d \t%d \t%d \t%s\n",XNASHP ,country,nvynum,ntn[country].nvy[nvynum].merchant,ntn[country].nvy[nvynum].warships,"null" )
  311. X#define    AADJLOC    fprintf(fexe,"A_LOC \t%d \t%hd \t%d \t%d \t%d \t%s\n",XALOC ,country,armynum,ntn[country].arm[armynum].xloc,ntn[country].arm[armynum].yloc,"null")
  312. X#define    NADJLOC    fprintf(fexe,"N_LOC \t%d \t%hd \t%d \t%d \t%d \t%s\n",XNLOC ,country,nvynum,ntn[country].nvy[nvynum].xloc,ntn[country].nvy[nvynum].yloc ,"null")
  313. X#define    AADJMOV    fprintf(fexe,"A_MOV \t%d \t%hd \t%d \t%d \t0 \t%s\n",XAMOV ,country,armynum,ntn[country].arm[armynum].smove,"null")
  314. X#define    NADJMOV    fprintf(fexe,"N_MOV \t%d \t%hd \t%d \t%d \t0 \t%s\n",XNMOV ,country,nvynum,ntn[country].nvy[nvynum].smove,"null")
  315. X#define    ECHGNAME fprintf(fexe,"E_CNAME \t%d \t%hd \t0 \t0 \t0 \t%s\n",XECNAME ,country,ntn[country].name)
  316. X#define    ECHGPAS    fprintf(fexe,"E_CPAS \t%d \t%hd \t0 \t0 \t0 \t%s\n",XECPAS ,country,crypt(string,SALT))
  317. X#define    SADJDES    fprintf(fexe,"S_ADES \t%d \t%hd \t0 \t%d \t%d \t%c\n",XSADES ,country,xcurs+xoffset,ycurs+yoffset,sct[xcurs+xoffset][ycurs+yoffset].designation)
  318. X#define    SADJDES2    fprintf(fexe,"S_ADES \t%d \t%hd \t0 \t%d \t%d \t%c\n",XSADES ,country,x,y,sct[x][y].designation)
  319. X#define    SADJCIV2    fprintf(fexe,"S_ACIV \t%d \t%hd \t%d \t%d \t%d \t%s\n",XSACIV ,country,sct[i][j].people,i,j,"null")
  320. X#define    SADJCIV    fprintf(fexe,"S_ACIV \t%d \t%hd \t%d \t%d \t%d \t%s\n",XSACIV ,country,sct[xcurs+xoffset][ycurs+yoffset].people,xcurs+xoffset,ycurs+yoffset,"null")
  321. X#define    INCFORT fprintf(fexe,"SIFORT \t%d \t%hd \t0 \t%d \t%d \t%s\n",XSIFORT ,country,xcurs+xoffset,ycurs+yoffset,"null")
  322. X#define    SADJOWN    fprintf(fexe,"S_AOWN \t%d \t%hd \t0 \t%d \t%d \t%s\n",XSAOWN ,country,xcurs+xoffset,ycurs+yoffset,"null")
  323. X#define    EADJDIP    fprintf(fexe,"E_ADJ \t%d \t%hd \t%d \t%d \t0 \t%s\n",EDADJ,country,nation,ntn[country].dstatus[nation],"null")
  324. X#define EDECSPL  fprintf(fexe,"E_SPL \t%d \t%hd \t%d \t%d \t0 \t%s\n",EDSPL,country,s_cost,0,"null")
  325. X
  326. X#define    S_MIL        0        /* position in powers array */
  327. X#define    WARRIOR        0x00000001L
  328. X#define    CAPTAIN        0x00000002L
  329. X#define    WARLORD        0x00000004L
  330. X#define    ARCHER        0x00000008L
  331. X#define    CAVALRY        0x00000010L
  332. X#define    SAPPER        0x00000020L
  333. X#define    ARMOR        0x00000040L
  334. X#define    AVIAN        0x00000080L
  335. X#define    MI_MONST    0x00000100L
  336. X#define    AV_MONST    0x00000200L
  337. X#define    MA_MONST    0x00000400L
  338. X#define    E_MIL        11
  339. X        /*CIVILIAN POWERS */
  340. X#define    S_CIV        11
  341. X#define    SLAVER        0x00000800L
  342. X#define    DERVISH        0x00001000L
  343. X#define    HIDDEN        0x00002000L
  344. X#define    ARCHITECT    0x00004000L
  345. X#define    HEALER        0x00008000L
  346. X#define    MINER        0x00010000L
  347. X#define    BREEDER        0x00020000L
  348. X#define    URBAN        0x00040000L
  349. X#define    STEEL        0x00080000L
  350. X#define    NINJA        0x00100000L
  351. X#define    SAILOR        0x00200000L
  352. X#define    DEMOCRACY    0x00400000L
  353. X#define    ROADS        0x00800000L
  354. X#define    E_CIV        13
  355. X            /* MAGICAL SKILLS */
  356. X#define    S_MGK        24
  357. X#define    THE_VOID    0x01000000L
  358. X#define    KNOWALL        0x02000000L
  359. X#define    DESTROYER    0x04000000L
  360. X#define    VAMPIRE        0x08000000L
  361. X#define    SUMMON        0x10000000L
  362. X#define    WYZARD        0x20000000L
  363. X#define    SORCERER    0x40000000L
  364. X#define    E_MGK        7
  365. X#define    MAXPOWER    31 /* number of powers */
  366. X
  367. X/*my first macro: which will return 1 if the nation has that power*/
  368. X#define    magic(NATION,POWER)    ((ntn[NATION].powers&(POWER))!=0)
  369. X
  370. X#define    ONMAP    (x>=0 && y>=0 && x<MAPX && y<MAPY)
  371. X
  372. X#ifndef HILIGHT
  373. X#define    standout()
  374. X#endif
  375. X
  376. X#ifdef BEEP
  377. X#define    beep()        putc('\007',stderr)
  378. X#else
  379. X#define    beep()
  380. X#endif
  381. X
  382. X#ifdef SYSV
  383. X#define    rand()        lrand48()
  384. X#define    srand(x)    srand48(x)
  385. X#else
  386. X#define    rand()        random()
  387. X#define    srand(x)    srandom(x)
  388. X#endif
  389. X
  390. X#define    FOODTHRESH    3
  391. X#define    GOLDTHRESH    10
  392. X#define    JEWELTHRESH    10
  393. X
  394. X#define    SALT "aa"    /* salt for crypt */
  395. X
  396. X
  397. Xextern    char    *ele;
  398. Xextern    char    *elename[];
  399. Xextern    char    *veg;
  400. Xextern    int    vegfood[];
  401. Xextern    char    *vegname[];
  402. Xextern    char    *numbers;
  403. Xextern    char    *Class[];
  404. Xextern    char    *races[];
  405. Xextern    char    *diploname[];
  406. Xextern    char    *soldname[];
  407. Xextern    char    *unittype[];
  408. Xextern    char    *shunittype[];
  409. Xextern    int    unitminsth[];
  410. Xextern    int    u_eniron[];
  411. Xextern    int    u_encost[];
  412. Xextern    int    unitmaint[];
  413. Xextern    char    *des;
  414. Xextern    char    *desname[];
  415. Xextern    char    *pwrname[];
  416. Xextern    long    powers[];
  417. X
  418. X#ifdef ADMIN
  419. Xextern    char    *npcsfile;
  420. Xextern    int    unitattack[];
  421. Xextern    int    unitdefend[];
  422. Xextern    int    unitmove[];
  423. X#endif ADMIN
  424. X
  425. X/*file name definitions */
  426. Xextern    char    *exefile;
  427. Xextern    char    *datafile;
  428. Xextern    char    *msgfile;
  429. Xextern    char    *helpfile;
  430. Xextern    char    *newsfile;
  431. Xextern    char    *isonfile;
  432. X
  433. X#define    abrt() { \
  434. Xfprintf(stderr,"\nSerious Error (File %s, Line %d) - Aborting\n",__FILE__,__LINE__); \
  435. Xexit(FAIL); \
  436. X}
  437. X
  438. X/* extern    everything else */
  439. Xextern    long exenewmgk(), getmagic(), getmagic(), getmgkcost(), score_one();
  440. Xextern    struct s_sector *rand_sector();
  441. X
  442. Xextern    void adjarm(),armymove(),armyrpt(),atkattr(),blowup();
  443. Xextern    void budget(),change(),cheat(),coffmap(),combat(),construct();
  444. Xextern    void defattr(),destroy(),diploscrn(),domagic(),draft(),erupt();
  445. Xextern    void fight(),fill_edge(),flee(),fleetrpt(),hangup(),help();
  446. Xextern    void highlight(),makemap(),makeside(),makeworld(),monster(),moveciv();
  447. Xextern    void mymove(),navalcbt(),newdip(),newdisplay(),newlogin();
  448. Xextern    void newspaper(),npcredes(),offmap(),place(),populate(),prep();
  449. Xextern    void printele(),printnat(),printscore(),printveg(),pr_ntns(),produce();
  450. Xextern    void readdata(),redesignate(),redomil(),reduce(),rmessage(),score();
  451. Xextern    void see(),showscore(),update(),updmove(),verifydata(),verify_ntn();
  452. Xextern    void verify_sct(),wmessage(),writedata(),getdstatus(),exit();
  453. X
  454. Xextern    char    *crypt(),*strcpy(),*strncpy(),*strcat(),*strncat();
  455. X
  456. X#define    HI_OWN        0    /* hilight modes */
  457. X#define    HI_ARMY        1
  458. X#define    HI_NONE        2
  459. X#define    HI_YARM        3
  460. X#define    HI_MOVE        4
  461. X
  462. X#define    DI_VEGE        1    /* display modes */
  463. X#define    DI_DESI        2
  464. X#define    DI_CONT        3
  465. X#define    DI_FOOD        4
  466. X#define    DI_NATI        5
  467. X#define    DI_RACE        6
  468. X#define    DI_MOVE        7
  469. X#define    DI_DEFE        8
  470. X#define    DI_PEOP        9
  471. X#define    DI_GOLD        10
  472. X#define    DI_IRON        11
  473. X
  474. Xextern    struct sprd_sht
  475. X{
  476. X    /* total product at end of turn */
  477. X    long food, gold, jewels, iron;
  478. X    /* revenue this turn */
  479. X    long revfood, revjewels, reviron, revcap, revcity;
  480. X    /* civilians in that type of sector */
  481. X    int ingold, iniron, infarm, incity, incap;
  482. X    int sectors, civilians;
  483. X} spread;
  484. END_OF_data.h
  485. if test 13697 -ne `wc -c <data.h`; then
  486.     echo shar: \"data.h\" unpacked with wrong size!
  487. fi
  488. # end of overwriting check
  489. fi
  490. if test -f magic.c -a "${1}" != "-c" ; then 
  491.   echo shar: Will not over-write existing file \"magic.c\"
  492. else
  493. echo shar: Extracting \"magic.c\" \(20241 characters\)
  494. sed "s/^X//" >magic.c <<'END_OF_magic.c'
  495. X/*conquer : Copyright (c) 1988 by Ed Barlow.
  496. X *  I spent a long time writing this code & I hope that you respect this.
  497. X *  I give permission to alter the code, but not to copy or redistribute
  498. X *  it without my explicit permission.  If you alter the code,
  499. X *  please document changes and send me a copy, so all can have it.
  500. X *  This code, to the best of my knowledge works well,  but it is my first
  501. X *  'C' program and should be treated as such.  I disclaim any
  502. X *  responsibility for the codes actions (use at your own risk).  I guess
  503. X *  I am saying "Happy gaming", and am trying not to get sued in the process.
  504. X *                                                Ed
  505. X */
  506. X
  507. X/*create a new login for a new player*/
  508. X#include "header.h"
  509. X#include "data.h"
  510. X#include <ctype.h>
  511. X
  512. Xextern short country;
  513. Xextern short redraw;
  514. Xextern FILE *fexe;
  515. Xextern FILE *fnews;
  516. X
  517. X/*give player one new magic power in current magic (powers)*/
  518. X/*do nothing if that player has that power or it is not permitted*/
  519. X/*getmagic() returns the value of the power gained, and stores it in power*/
  520. X
  521. Xlong
  522. Xgetmagic(type)
  523. Xint type;
  524. X{
  525. X    long newpower;
  526. X    int start,end;
  527. X    switch(type){
  528. X        case M_MGK:
  529. X            start=S_MGK;
  530. X            end=E_MGK;
  531. X            break;
  532. X        case M_CIV:
  533. X            start=S_CIV;
  534. X            end=E_CIV;
  535. X            break;
  536. X        case M_MIL:
  537. X            start=S_MIL;
  538. X            end=E_MIL;
  539. X            break;
  540. X        default:
  541. X            printf("fatal error in num_powers");
  542. X            abrt();
  543. X    }
  544. X    newpower=powers[start+(rand()%end)];
  545. X    if(newpower==0) {
  546. X        printf("ILLEGAL POWER");
  547. X        abrt();
  548. X    }
  549. X
  550. X    if((newpower==WARRIOR)||(newpower==CAPTAIN)||(newpower==WARLORD)){
  551. X        if(magic(country,WARRIOR)!=TRUE){
  552. X            ntn[country].powers|=WARRIOR;
  553. X            return(WARRIOR);
  554. X        }
  555. X        else if(magic(country,CAPTAIN)!=TRUE){
  556. X            ntn[country].powers|=CAPTAIN;
  557. X            return(CAPTAIN);
  558. X        }
  559. X        else if(magic(country,WARLORD)!=TRUE){
  560. X            ntn[country].powers|=WARLORD;
  561. X            return(WARLORD);
  562. X        }
  563. X        else return(0L);
  564. X    }else if((newpower==MI_MONST) ||(newpower==AV_MONST) ||(newpower==MA_MONST)){
  565. X        if(ntn[country].race!=ORC) return(0L);
  566. X        if(magic(country,MI_MONST)!=TRUE){
  567. X            ntn[country].powers|=MI_MONST;
  568. X            return(MI_MONST);
  569. X        }
  570. X        else if(magic(country,AV_MONST)!=TRUE){
  571. X            ntn[country].powers|=AV_MONST;
  572. X            return(AV_MONST);
  573. X        }
  574. X        else if(magic(country,MA_MONST)==TRUE){
  575. X            ntn[country].powers|=MA_MONST;
  576. X            return(MA_MONST);
  577. X        }
  578. X        else return(0L);
  579. X    }else if(newpower==CAVALRY){
  580. X        if(ntn[country].active >= 2) return(0L);    /*npc nation*/
  581. X        if(magic(country,newpower)==TRUE) return(0L);
  582. X        ntn[country].powers|=newpower;
  583. X        return(newpower);
  584. X    }else if(newpower==URBAN){
  585. X        if(magic(country,BREEDER)==TRUE) return(0L);
  586. X        if(magic(country,newpower)==TRUE) return(0L);
  587. X        ntn[country].powers|=newpower;
  588. X        return(newpower);
  589. X    }else if(newpower==HEALER){
  590. X        if(ntn[country].race==ORC) return(0L);
  591. X        if(magic(country,newpower)==TRUE) return(0L);
  592. X        ntn[country].powers|=newpower;
  593. X        return(newpower);
  594. X    }else if(newpower==KNOWALL){
  595. X#ifdef OGOD
  596. X         /* only god should have KNOWALL if sectors hidden */
  597. X         if(country!=0) return(0L);
  598. X#endif
  599. X         if(magic(country,KNOWALL)==TRUE) return(0L);
  600. X         ntn[country].powers|=KNOWALL;
  601. X         return(KNOWALL);
  602. X    }else if((newpower==SLAVER)
  603. X    ||(newpower==DERVISH)
  604. X    ||(newpower==HIDDEN)
  605. X    ||(newpower==ARCHITECT)
  606. X    ||(newpower==THE_VOID)
  607. X    ||(newpower==ARCHER)){
  608. X        if(magic(country,newpower)==TRUE) return(0L);
  609. X        ntn[country].powers|=newpower;
  610. X        return(newpower);
  611. X    }else if(newpower==DESTROYER){
  612. X        if((ntn[country].race!=ELF)&&(magic(country,DESTROYER)!=TRUE)){
  613. X            ntn[country].powers|=DESTROYER;
  614. X            return(DESTROYER);
  615. X        }
  616. X        return(0L);
  617. X    }else if(newpower==VAMPIRE){
  618. X        if((ntn[country].race!=ELF)&&(magic(country,VAMPIRE)!=TRUE)){
  619. X            ntn[country].powers|=VAMPIRE;
  620. X            return(VAMPIRE);
  621. X        }
  622. X        return(0L);
  623. X    }else if(newpower==MINER){
  624. X        if((ntn[country].race!=ELF)&&(ntn[country].race!=DWARF)&&(magic(country,MINER)!=TRUE)){
  625. X            ntn[country].powers|=MINER;
  626. X            return(MINER);
  627. X        }
  628. X        return(0L);
  629. X    }else if(newpower==STEEL){
  630. X        if(magic(country,STEEL)==TRUE) return(0L);
  631. X        if(magic(country,MINER)!=TRUE) return(0L);
  632. X        ntn[country].powers|=STEEL;
  633. X        return(STEEL);
  634. X    }else if(newpower==BREEDER){
  635. X        if(magic(country,URBAN)==TRUE) return(0L);
  636. X        if(magic(country,BREEDER)==TRUE) return(0L);
  637. X        if(ntn[country].race!=ORC) return(0L);
  638. X        ntn[country].powers|=BREEDER;
  639. X        return(BREEDER);
  640. X    }
  641. X    else if(ntn[country].active >= 2) return(0L);    /*npc nation*/
  642. X    else if((newpower==NINJA)
  643. X    ||(newpower==SLAVER)
  644. X    ||(newpower==SAILOR)
  645. X    ||(newpower==DEMOCRACY)
  646. X    ||(newpower==ROADS)
  647. X    ||(newpower==SUMMON)
  648. X    ||(newpower==WYZARD)
  649. X    ||(newpower==SORCERER)
  650. X    ||(newpower==SAPPER)
  651. X    ||(newpower==ARMOR)
  652. X    ||(newpower==AVIAN)){    /* these powers are only for pc's */
  653. X        if(magic(country,newpower)==TRUE) return(0L);
  654. X        ntn[country].powers|=newpower;
  655. X        return(newpower);
  656. X    }
  657. X    else return(0L);
  658. X}
  659. X#ifdef CONQUER
  660. X/*form to interactively get a magic power*/
  661. Xvoid
  662. Xdomagic()
  663. X{
  664. X    int count, done=FALSE, loop=0, i,type;
  665. X    long price,x;
  666. X    short isgod=0;
  667. X    if(country==0) {
  668. X        isgod=1;
  669. X        clear();
  670. X        mvaddstr(0,0,"WHAT NATION NUMBER:");
  671. X        refresh();
  672. X        country = get_number();
  673. X    }
  674. X
  675. X    while(done==FALSE){
  676. X        done=TRUE;
  677. X        clear();
  678. X        count=3;
  679. X        redraw=TRUE;
  680. X        standout();
  681. X        mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",ntn[country].name);
  682. X        mvprintw(count++,30,"1) %d military powers: %ld jewels",
  683. X            num_powers(country,M_MIL) ,getmgkcost(M_MIL,country));
  684. X        mvprintw(count++,30,"2) %d civilian powers: %ld jewels",
  685. X            num_powers(country,M_CIV) ,getmgkcost(M_CIV,country));
  686. X        mvprintw(count++,30,"3) %d magic powers:    %ld jewels",
  687. X            num_powers(country,M_MGK),getmgkcost(M_MGK,country));
  688. X
  689. X        price =  getmgkcost(M_MIL,country);
  690. X        if(price > getmgkcost(M_CIV,country))
  691. X            price = getmgkcost(M_CIV,country);
  692. X        if(price > getmgkcost(M_MGK,country))
  693. X            price = getmgkcost(M_MGK,country);
  694. X
  695. X        standend();
  696. X        count=3;
  697. X        /*print the powers that you have*/
  698. X        i=0;
  699. X        while( powers[i] != 0 ){
  700. X            if(magic(country,powers[i])==TRUE)
  701. X            mvprintw(count++,0,"you have power %s",*(pwrname+i));
  702. X            i++;
  703. X        }
  704. X
  705. X        if(count<=7) count=8;
  706. X        else count++;
  707. X        standout();
  708. X        mvprintw(count++,0,"YOU HAVE %ld JEWELS IN YOUR TREASURY",ntn[country].jewels);
  709. X        if(price < ntn[country].jewels){
  710. X        mvaddstr(count++,0,"DO YOU WISH TO BUY A RANDOM NEW POWER (enter y or n):");
  711. X        standend();
  712. X        refresh();
  713. X        count++;
  714. X        if(getch()=='y'){
  715. X            done=FALSE;
  716. X            mvprintw(count++,0,"ENTER SELECTION (1,2,3):");
  717. X            refresh();
  718. X            type = get_number();
  719. X            if(type==M_MIL || type==M_CIV || type==M_MGK){
  720. X            price=getmgkcost(type,country);
  721. X#ifdef OGOD
  722. X            if (isgod==TRUE) price=0;
  723. X#endif OGOD
  724. X            if(ntn[country].jewels>=price) {
  725. X                loop = 0;
  726. X                while(loop++ < 500) if((x=getmagic(type))!=0){
  727. X                    ntn[country].jewels -= price;
  728. X                    CHGMGK;
  729. X                    exenewmgk(x);
  730. X                    refresh();
  731. X                    if (isgod==TRUE) country=0;
  732. X                    return;
  733. X                }
  734. X                if (loop >= 500)
  735. X                    mvaddstr(count++,0,"You have too many powers! -- hit any key");
  736. X                    refresh();
  737. X                    getch();
  738. X            } else {
  739. X            mvaddstr(count++,0,"NOT ENOUGH JEWELS TO PURCHASE NEW MAGIC -- hit any key");
  740. X            refresh();
  741. X            getch();
  742. X            }
  743. X            } else {
  744. X            mvaddstr(count++,0,"INVALID SELECTION -- hit any key");
  745. X            refresh();
  746. X            getch();
  747. X            }
  748. X        }
  749. X        } else {
  750. X            mvaddstr(count++,0,"CAN NOT BUY NEW POWER - hit any key");
  751. X            standend();
  752. X            refresh();
  753. X            getch();
  754. X        }
  755. X        if(magic(country,SUMMON)==TRUE)
  756. X            done=dosummon(&count);
  757. X#ifdef ORCTAKE
  758. X        if((ntn[country].race==ORC)&&(ntn[country].jewels>=TAKEPRICE))
  759. X            done=orctake(&count);
  760. X#endif ORCTAKE
  761. X#ifdef OGOD
  762. X        if (isgod==TRUE) {
  763. X            mvaddstr(count++,0,"GOD: REMOVE A MAGIC POWER? (y or n)");
  764. X            refresh();
  765. X            if (getch()=='y') killmagk();
  766. X        }
  767. X#endif OGOD
  768. X    }
  769. X    if(isgod==1) country=0;
  770. X}
  771. X#endif CONQUER
  772. X/*do magic for both npcs and pcs in update*/
  773. X/*if target is 0 then it is update and target will be picked randomly*/
  774. Xint
  775. Xtakeover(percent,target)
  776. Xint percent,target;
  777. X{
  778. X    int loop=1,y,save,isupdate=0;
  779. X    save=country;
  780. X    if(target==country) return(0);
  781. X    if(target==0) isupdate=1;
  782. X    country=target;
  783. X    if(rand()%100<percent){
  784. X        loop=0;
  785. X        y=0;
  786. X        if (target==0) while(loop==0){
  787. X            y++;
  788. X            country=rand()%MAXNTN;
  789. X            if((ntn[country].race==ntn[save].race)
  790. X            &&(ntn[country].active>=2)
  791. X            &&(country!=save)) loop=1;
  792. X            else if(y>=500) {
  793. X                country=save;
  794. X                return(0);
  795. X            }
  796. X        }
  797. X        sct[ntn[country].capx][ntn[country].capy].owner=save;
  798. X        if(isupdate==1){
  799. X        printf("nation %s taken over by %s\n",ntn[country].name,ntn[save].name);
  800. X        fprintf(fnews,"1.\tnation %s taken over by %s\n",ntn[country].name,ntn[save].name);
  801. X        }
  802. X        else {
  803. X            DESTROY;
  804. X            if ((fnews=fopen("/dev/null","w"))==NULL){
  805. X                printf("error opening null file\n");
  806. X                exit(FAIL);
  807. X            }
  808. X        }
  809. X        destroy(country);
  810. X        if(isupdate!=1) fclose(fnews);
  811. X        y=country;
  812. X        country=save;
  813. X        return(y);
  814. X    }
  815. X    country=save;
  816. X    return(0);
  817. X}
  818. X
  819. X/*execute new magic*/
  820. Xlong
  821. Xexenewmgk(newpower)
  822. Xlong newpower;
  823. X{
  824. X    short x,y;
  825. X    if(newpower==WARRIOR) {
  826. X        ntn[country].aplus+=10;
  827. X        ntn[country].dplus+=10;
  828. X        return(0L);
  829. X    }
  830. X    if(newpower==CAPTAIN) {
  831. X        ntn[country].aplus+=10;
  832. X        ntn[country].dplus+=10;
  833. X        return(0L);
  834. X    }
  835. X    if(newpower==WARLORD) {
  836. X        ntn[country].aplus+=10;
  837. X        ntn[country].dplus+=10;
  838. X        return(0L);
  839. X    }
  840. X    if(newpower==HEALER) {
  841. X        if(ntn[country].race==ORC) {
  842. X            printf("ORCS CANT HAVE HEALER POWER\n");
  843. X            abrt();
  844. X        } else if(ntn[country].repro<=8){
  845. X            ntn[country].repro+=2;
  846. X        } else if(ntn[country].repro==9){
  847. X            ntn[country].repro=10;
  848. X            ntn[country].dplus+=5;
  849. X        } else if(ntn[country].repro>=10){
  850. X            ntn[country].dplus+=10;
  851. X        }
  852. X        return(0L);
  853. X    }
  854. X    if(newpower==DESTROYER) {
  855. X        for(x=ntn[country].capx-3;x<=ntn[country].capx+3;x++) {
  856. X            for(y=ntn[country].capy-3;y<=ntn[country].capy+3;y++){
  857. X                if((ONMAP)
  858. X                &&(sct[x][y].altitude!=WATER)
  859. X#ifdef DERVDESG
  860. X                &&((rand()%2)==0)
  861. X#else
  862. X                &&(tofood(sct[x][y].vegetation,0)<DESFOOD)
  863. X#endif DERVDESG
  864. X                &&((x!=ntn[country].capx)
  865. X                    ||(y!=ntn[country].capy))){
  866. X                    sct[x][y].vegetation=DESERT;
  867. X                    sct[x][y].designation=DNODESIG;
  868. X                }
  869. X            }
  870. X        }
  871. X        updmove(ntn[country].race,country);
  872. X        return(0L);
  873. X    }
  874. X    if(newpower==DERVISH) {
  875. X        updmove(ntn[country].race,country);
  876. X        return(0L);
  877. X    }
  878. X    if((newpower==MI_MONST)
  879. X    ||(newpower==AV_MONST)
  880. X    ||(newpower==MA_MONST)
  881. X    ||(newpower==KNOWALL)
  882. X    ||(newpower==HIDDEN)
  883. X    ||(newpower==THE_VOID)
  884. X    ||(newpower==ARCHITECT)
  885. X    ||(newpower==MINER))
  886. X        return(0L);
  887. X    if(newpower==VAMPIRE) {
  888. X        ntn[country].aplus-=35;
  889. X        ntn[country].dplus-=35;
  890. X        ntn[country].maxmove-=2;
  891. X        return(0L);
  892. X    }
  893. X    if(newpower==URBAN) {
  894. X        if(ntn[country].race==ORC) {
  895. X            x=ntn[country].repro;
  896. X            if(ntn[country].repro>=13){
  897. X                ntn[country].maxmove+=4;
  898. X            }
  899. X            else if(ntn[country].repro>10){
  900. X                ntn[country].maxmove+=2*(x-10);
  901. X                ntn[country].repro=13;
  902. X            }
  903. X            else ntn[country].repro+=3;
  904. X        }
  905. X        else if(ntn[country].repro<=9){
  906. X            ntn[country].repro+=3;
  907. X        }
  908. X        else {
  909. X            ntn[country].maxmove+=2*(ntn[country].repro-9);
  910. X            ntn[country].repro=12;
  911. X        }
  912. X        return(0L);
  913. X    }
  914. X    if(newpower==BREEDER) {
  915. X        ntn[country].repro+=3;
  916. X        ntn[country].dplus-=10;
  917. X        ntn[country].aplus-=10;
  918. X        return(0L);
  919. X    }
  920. X    if(newpower==DEMOCRACY){
  921. X        ntn[country].repro+=1;
  922. X        ntn[country].dplus+=10;
  923. X        ntn[country].aplus+=10;
  924. X        return(0L);
  925. X    }
  926. X    if(newpower==ROADS){
  927. X        ntn[country].maxmove+=4;
  928. X        return(0L);
  929. X    }
  930. X    if(newpower==ARMOR){
  931. X        ntn[country].maxmove-=3;
  932. X        if( ntn[country].maxmove<4) ntn[country].maxmove=4;
  933. X        ntn[country].dplus+=20;
  934. X    }
  935. X    if((newpower==NINJA)
  936. X    ||(newpower==STEEL)
  937. X    ||(newpower==ARCHER)
  938. X    ||(newpower==CAVALRY)
  939. X    ||(newpower==SAILOR)
  940. X    ||(newpower==SUMMON)
  941. X    ||(newpower==WYZARD)
  942. X    ||(newpower==SORCERER)
  943. X    ||(newpower==SAPPER)
  944. X    ||(newpower==AVIAN)){    /* these powers are only for pc's */
  945. X        return(1L);
  946. X    }
  947. X    return(0L);
  948. X}
  949. X#ifdef CONQUER
  950. X/* returns 0 if summon occurred, 1 else */
  951. Xint
  952. Xdosummon(count)
  953. Xint *count;
  954. X{
  955. X    int done=TRUE,x,i,armynum;
  956. X    long e_cost;
  957. X    int newtype,s_cost;
  958. X    if((*count)>20) {
  959. X        (*count)=2;
  960. X        clear();
  961. X    }
  962. X    mvaddstr((*count)++,0,"YOU HAVE SUMMON POWER");
  963. X    mvaddstr((*count)++,0,"DO YOU WISH SUMMON A MONSTER (enter y or n):");
  964. X    refresh();
  965. X    if(getch()=='y'){
  966. X        done=FALSE;
  967. X        x=0;
  968. X        mvaddstr((*count)++,x,"options:");
  969. X        x+=9;
  970. X        for(i=MINMONSTER;i<=MAXMONSTER;i++){
  971. X            if(unitvalid(i)==TRUE) {
  972. X                mvprintw((*count),x+2,"%s",*(shunittype+(i%200)));
  973. X                mvprintw((*count),x,"(%c)",*(shunittype+(i%200))[0]);
  974. X                x+=7;
  975. X                if(x>COLS-20){
  976. X                    x=0;
  977. X                    (*count)++;
  978. X                }
  979. X            }
  980. X        }
  981. X        (*count)++;
  982. X        mvaddstr((*count)++,0,"what type of unit do you want to raise:");
  983. X        refresh();
  984. X
  985. X        newtype='0';
  986. X        switch(getch()){
  987. X        case 's':
  988. X            newtype=SPIRIT;
  989. X            break;
  990. X        case 'A':
  991. X            newtype=ASSASSIN;
  992. X            break;
  993. X        case 'e':
  994. X            newtype=DJINNI;
  995. X            break;
  996. X        case 'G':
  997. X            newtype=GARGOYLE;
  998. X            break;
  999. X        case 'W':
  1000. X            newtype=WRAITH;
  1001. X            break;
  1002. X        case 'H':
  1003. X            newtype=HERO;
  1004. X            break;
  1005. X        case 'C':
  1006. X            newtype=CENTAUR;
  1007. X            break;
  1008. X        case 'g':
  1009. X            newtype=GIANT;
  1010. X            break;
  1011. X        case 'S':
  1012. X            newtype=SUPERHERO;
  1013. X            break;
  1014. X        case 'M':
  1015. X            newtype=MUMMY;
  1016. X            break;
  1017. X        case 'E':
  1018. X            newtype=ELEMENTAL;
  1019. X            break;
  1020. X        case 'm':
  1021. X            newtype=MINOTAUR;
  1022. X            break;
  1023. X        case 'd':
  1024. X            newtype=DEMON;
  1025. X            break;
  1026. X        case 'B':
  1027. X            newtype=BALROG;
  1028. X            break;
  1029. X        case 'D':
  1030. X            newtype=DRAGON;
  1031. X            break;
  1032. X        default:
  1033. X            break;
  1034. X        }
  1035. X
  1036. X        if(unitvalid(newtype)==FALSE) {
  1037. X            beep();
  1038. X            mvprintw((*count)++,0,"%d INVALID TYPE",newtype);
  1039. X            refresh();
  1040. X            sleep(2);
  1041. X            return(done);
  1042. X        }
  1043. X
  1044. X        e_cost= (long) *(u_encost+(newtype%200)) * *(unitminsth+(newtype%200));
  1045. X        s_cost= *(u_encost+(newtype%200));
  1046. X        /*check to see if enough spell points*/
  1047. X        if(s_cost > ntn[country].spellpts) {
  1048. X            mvprintw((*count)++,0,"you dont have %d spell points",s_cost);
  1049. X            refresh();
  1050. X            sleep(1);
  1051. X            return(done);
  1052. X        }
  1053. X
  1054. X        /*check to see if enough gold*/
  1055. X        if(e_cost >  ntn[country].tgold) {
  1056. X            mvprintw((*count)++,0,"you dont have %ld gold in treasury",e_cost);
  1057. X            refresh();
  1058. X            sleep(1);
  1059. X            return(done);
  1060. X        }
  1061. X
  1062. X        armynum=0;
  1063. X        while(armynum<MAXARM) {
  1064. X            if(ASOLD<=0) {
  1065. X                ASOLD= *(unitminsth+(newtype%200));
  1066. X                ATYPE=newtype;
  1067. X                ASTAT=DEFEND; /* set new armies to DEFEND */
  1068. X                AXLOC=ntn[country].capx;
  1069. X                AYLOC=ntn[country].capy;
  1070. X                AMOVE=0;
  1071. X                AADJLOC;
  1072. X                AADJSTAT;
  1073. X                AADJMEN;
  1074. X                AADJMOV;
  1075. X                armynum=MAXARM;
  1076. X            } else if(armynum==MAXARM-1) {
  1077. X                mvaddstr((*count)++,0,"NO FREE ARMIES");
  1078. X                refresh();
  1079. X                sleep(2);
  1080. X                return(done);
  1081. X            } else armynum++;
  1082. X        }
  1083. X        ntn[country].tgold -= e_cost;
  1084. X        ntn[country].spellpts -= s_cost;
  1085. X        EDECSPL;
  1086. X    }
  1087. X    return(done);
  1088. X}
  1089. X#endif CONQUER
  1090. X#ifdef CONQUER
  1091. X#ifdef ORCTAKE
  1092. X/* orc takeover routine... returns 0 if run, 1 if not */
  1093. Xorctake(count)
  1094. Xint *count;
  1095. X{
  1096. X    int chance=0;
  1097. X    if((*count)>20) {
  1098. X        (*count)=2;
  1099. X        clear();
  1100. X    }
  1101. X    if(magic((*count)ry,MA_MONST)==TRUE) {
  1102. X    mvaddstr((*count)++,0,"  You have a 10 percent chance for %ld Jewels take over other orcs",TAKEPRICE);
  1103. X    chance=10;
  1104. X    } else if(magic((*count)ry,AV_MONST)==TRUE) {
  1105. X    mvaddstr((*count)++,0,"  You have a 6 percent chance for %ld Jewels take over other orcs",TAKEPRICE);
  1106. X    chance=6;
  1107. X    } else if(magic((*count)ry,MI_MONST)==TRUE){
  1108. X    mvaddstr((*count)++,0,"  You have a 3 percent chance for %ld Jewels to take over other orcs",TAKEPRICE);
  1109. X    chance=3;
  1110. X    }
  1111. X    if(chance==0) return(1);
  1112. X
  1113. X    mvprintw((*count)++,0,"DO YOU WISH TO TAKE OVER AN ORC NPC NATION (enter y or n):");
  1114. X    refresh();
  1115. X    if(getch()=='y'){
  1116. X        done=FALSE;
  1117. X        mvaddstr((*count)++,0,"  What orc nation (number):");
  1118. X        refresh();
  1119. X        i=get_number();
  1120. X        if(ntn[i].race==ORC){
  1121. X            ntn[(*count)ry].jewels-=TAKEPRICE;
  1122. X            if((i=takeover(chance,i))==1)
  1123. X            mvprintw((*count)++,0," Successful: %d",i);
  1124. X        }
  1125. X        else mvaddstr((*count)++,0,"  Wrong Race");
  1126. X    }
  1127. X    return(done);
  1128. X}
  1129. X#endif ORCTAKE
  1130. X#endif CONQUER
  1131. X#ifdef CONQUER
  1132. X/* unitvalid tells if nation has powers needed to draft unit */
  1133. Xint
  1134. Xunitvalid(type)
  1135. Xint type;
  1136. X{
  1137. X    int valid=FALSE;
  1138. X    switch(type){
  1139. X        case GARGOYLE:
  1140. X        case A_GOBLIN:
  1141. X        case A_ORC:    if(magic(country,MI_MONST)==TRUE) valid=TRUE;
  1142. X                break;
  1143. X        case A_MARINES: if(magic(country,SAILOR)==TRUE) valid=TRUE;
  1144. X                break;
  1145. X        case A_ARCHER:    if(magic(country,ARCHER)==TRUE) valid=TRUE;
  1146. X                break;
  1147. X        case A_URUK:    if(magic(country,AV_MONST)==TRUE) valid=TRUE;
  1148. X                break;
  1149. X        case A_NINJA:    if(magic(country,NINJA)==TRUE) valid=TRUE;
  1150. X                break;
  1151. X        case A_PHALANX:    if(magic(country,CAPTAIN)==TRUE) valid=TRUE;
  1152. X                break;
  1153. X        case A_OLOG:    if((magic(country,BREEDER)==TRUE)
  1154. X                &&(magic(country,AV_MONST)==TRUE)) valid=TRUE;
  1155. X                break;
  1156. X        case A_ELEPHANT:if(magic(country,DERVISH)==TRUE)  valid=TRUE;
  1157. X                break;
  1158. X        case SUPERHERO:
  1159. X        case A_LEGION:    if(magic(country,WARLORD)==TRUE) valid=TRUE;
  1160. X                break;
  1161. X        case A_DRAGOON:    if(magic(country,CAVALRY)==TRUE) valid=TRUE;
  1162. X                break;
  1163. X        case A_TROLL:    if(magic(country,MA_MONST)==TRUE) valid=TRUE;
  1164. X                break;
  1165. X        case A_ELITE:    if(magic(country,STEEL)==TRUE) valid=TRUE;
  1166. X                break;
  1167. X        case A_LT_CAV:
  1168. X        case A_CAVALRY:    if(magic(country,CAVALRY)==TRUE) valid=TRUE;
  1169. X                break;
  1170. X        case A_KNIGHT:    if((magic(country,ARMOR)==TRUE)
  1171. X                &&(magic(country,CAVALRY)==TRUE)) valid=TRUE;
  1172. X                break;
  1173. X        case A_ROC:
  1174. X        case A_GRIFFON: if(magic(country,AVIAN)==TRUE) valid=TRUE;
  1175. X                break;
  1176. X        case ASSASSIN:    if(magic(country,NINJA)==TRUE) valid=TRUE;
  1177. X                break;
  1178. X        case DJINNI:    if(magic(country,DERVISH)==TRUE) valid=TRUE;
  1179. X                break;
  1180. X        case HERO:    if(magic(country,WARRIOR)==TRUE) valid=TRUE;
  1181. X                break;
  1182. X        case ELEMENTAL:    if(magic(country,SORCERER)==TRUE) valid=TRUE;
  1183. X                break;
  1184. X        case WRAITH:
  1185. X        case MUMMY:    if(magic(country,VAMPIRE)==TRUE) valid=TRUE;
  1186. X                break;
  1187. X        case MINOTAUR:
  1188. X        case DEMON:    if(magic(country,DESTROYER)==TRUE) valid=TRUE;
  1189. X                break;
  1190. X        case BALROG:    if((magic(country,WYZARD)==TRUE)
  1191. X                &&(magic(country,VAMPIRE)==TRUE)) valid=TRUE;
  1192. X                break;
  1193. X        case DRAGON:    if((magic(country,MA_MONST)==TRUE)
  1194. X                &&(magic(country,WYZARD)==TRUE)) valid=TRUE;
  1195. X                break;
  1196. X        default:    valid=TRUE;    /* for all unrestricted types */
  1197. X    }
  1198. X    return(valid);
  1199. X}
  1200. X#endif CONQUER
  1201. X
  1202. X#ifdef OGOD
  1203. X/*remove a magic power*/
  1204. Xlong
  1205. Xremovemgk(oldpower)
  1206. Xlong oldpower;
  1207. X{
  1208. X    short x,y;
  1209. X    if((oldpower==WARRIOR)
  1210. X    ||(oldpower==CAPTAIN)
  1211. X    ||(oldpower==WARLORD)) {
  1212. X        ntn[country].aplus-=10;
  1213. X        ntn[country].dplus-=10;
  1214. X        return(0L);
  1215. X    }
  1216. X    if(oldpower==HEALER) {
  1217. X        if(ntn[country].race==ORC) {
  1218. X            printf("ORCS CANT HAVE HEALER POWER\n");
  1219. X            abrt();
  1220. X        } else ntn[country].repro -= 2;
  1221. X        return(0L);
  1222. X    }
  1223. X    if(oldpower==DESTROYER) {
  1224. X        for(x=ntn[country].capx-3;x<=ntn[country].capx+3;x++) {
  1225. X            for(y=ntn[country].capy-3;y<=ntn[country].capy+3;y++){
  1226. X                if((ONMAP)
  1227. X                &&(sct[x][y].altitude!=WATER)
  1228. X                &&((x!=ntn[country].capx)
  1229. X                    ||(y!=ntn[country].capy))){
  1230. X                    if (sct[x][y].vegetation==DESERT)
  1231. X                    {
  1232. X                        /* LT_VEG has medium value*/
  1233. X                        sct[x][y].vegetation=LT_VEG;
  1234. X                        sct[x][y].designation=DNODESIG;
  1235. X                    }
  1236. X                }
  1237. X            }
  1238. X        }
  1239. X        updmove(ntn[country].race,country);
  1240. X        return(0L);
  1241. X    }
  1242. X    if(oldpower==DERVISH) {
  1243. X        updmove(ntn[country].race,country);
  1244. X        return(0L);
  1245. X    }
  1246. X    if((oldpower==MI_MONST)
  1247. X    ||(oldpower==AV_MONST)
  1248. X    ||(oldpower==MA_MONST)
  1249. X    ||(oldpower==KNOWALL)
  1250. X    ||(oldpower==HIDDEN)
  1251. X    ||(oldpower==THE_VOID)
  1252. X    ||(oldpower==ARCHITECT)
  1253. X    ||(oldpower==MINER))
  1254. X        return(0L);
  1255. X    if(oldpower==VAMPIRE) {
  1256. X        ntn[country].aplus+=35;
  1257. X        ntn[country].dplus+=35;
  1258. X        ntn[country].maxmove+=2;
  1259. X        return(0L);
  1260. X    }
  1261. X    if(oldpower==URBAN) {
  1262. X        ntn[country].repro -= 3;
  1263. X        return(0L);
  1264. X    }
  1265. X    if(oldpower==BREEDER) {
  1266. X        ntn[country].repro-=3;
  1267. X        ntn[country].dplus+=10;
  1268. X        ntn[country].aplus+=10;
  1269. X        return(0L);
  1270. X    }
  1271. X    if(oldpower==DEMOCRACY){
  1272. X        ntn[country].repro-=1;
  1273. X        ntn[country].dplus-=10;
  1274. X        ntn[country].aplus-=10;
  1275. X        return(0L);
  1276. X    }
  1277. X    if(oldpower==ROADS){
  1278. X        ntn[country].maxmove-=4;
  1279. X        return(0L);
  1280. X    }
  1281. X    if(oldpower==ARMOR){
  1282. X        ntn[country].maxmove+=3;
  1283. X        ntn[country].dplus-=20;
  1284. X    }
  1285. X    if((oldpower==NINJA)
  1286. X    ||(oldpower==STEEL)
  1287. X    ||(oldpower==ARCHER)
  1288. X    ||(oldpower==CAVALRY)
  1289. X    ||(oldpower==SAILOR)
  1290. X    ||(oldpower==SUMMON)
  1291. X    ||(oldpower==WYZARD)
  1292. X    ||(oldpower==SORCERER)
  1293. X    ||(oldpower==SAPPER)
  1294. X    ||(oldpower==AVIAN)){    /* these powers are only for pc's */
  1295. X        return(1L);
  1296. X    }
  1297. X    return(0L);
  1298. X}
  1299. X
  1300. X#ifdef CONQUER
  1301. X/* killmagk: this routine removes a magic power */
  1302. Xkillmagk()
  1303. X{
  1304. X    int count,choice,i;
  1305. X    long holdmagk;
  1306. X
  1307. X    clear();
  1308. X    count=3;
  1309. X    standout();
  1310. X    mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",ntn[country].name);
  1311. X    standend();
  1312. X    i=0;
  1313. X    while( powers[i] != 0 ){
  1314. X        if(magic(country,powers[i])==TRUE)
  1315. X        mvprintw(count,0,"%d: power %s",count-2,*(pwrname+i));
  1316. X        count++;
  1317. X        i++;
  1318. X    }
  1319. X    count++;
  1320. X    standout();
  1321. X    mvaddstr(count++,5," Which power to remove? ");
  1322. X    standend();
  1323. X    refresh();
  1324. X    choice=get_number();
  1325. X    if (choice>count-5) choice=0;
  1326. X    mvprintw(count++,0," Remove magic #%d? (y or [n])",choice);
  1327. X    refresh();
  1328. X    if ((getch()=='y')&&(choice!=0)) {
  1329. X        i=0;
  1330. X        if (magic(country,holdmagk=powers[i])==TRUE) choice--;
  1331. X        while(choice) {
  1332. X            i++;
  1333. X            if (magic(country,holdmagk=powers[i])==TRUE)
  1334. X        choice--;
  1335. X        }
  1336. X        ntn[country].powers ^= holdmagk;
  1337. X        removemgk(holdmagk);
  1338. X    }
  1339. X}
  1340. X#endif CONQUER
  1341. X#endif OGOD
  1342. END_OF_magic.c
  1343. if test 20241 -ne `wc -c <magic.c`; then
  1344.     echo shar: \"magic.c\" unpacked with wrong size!
  1345. fi
  1346. # end of overwriting check
  1347. fi
  1348. if test -f main.c -a "${1}" != "-c" ; then 
  1349.   echo shar: Will not over-write existing file \"main.c\"
  1350. else
  1351. echo shar: Extracting \"main.c\" \(19741 characters\)
  1352. sed "s/^X//" >main.c <<'END_OF_main.c'
  1353. X/*conquer : Copyright (c) 1988 by Ed Barlow.
  1354. X *  I spent a long time writing this code & I hope that you respect this.
  1355. X *  I give permission to alter the code, but not to copy or redistribute
  1356. X *  it without my explicit permission.  If you alter the code,
  1357. X *  please document changes and send me a copy, so all can have it.
  1358. X *  This code, to the best of my knowledge works well,  but it is my first
  1359. X *  'C' program and should be treated as such.  I disclaim any
  1360. X *  responsibility for the codes actions (use at your own risk).  I guess
  1361. X *  I am saying "Happy gaming", and am trying not to get sued in the process.
  1362. X *                                                Ed
  1363. X */
  1364. X
  1365. X/*include files*/
  1366. X#include <ctype.h>
  1367. X#include "header.h"
  1368. X#include "data.h"
  1369. X#include <signal.h>
  1370. X#include <fcntl.h>
  1371. X#include  <pwd.h>
  1372. X
  1373. Xextern    int armornvy;
  1374. X
  1375. X/*Declarations*/
  1376. Xchar    fison[20];
  1377. Xchar    *getpass();
  1378. Xstruct    s_sector sct[MAPX][MAPY];
  1379. Xstruct    nation ntn[NTOTAL];   /* player nation stats */
  1380. X/*is sector occupied by an army?*/
  1381. Xchar    occ[MAPX][MAPY];
  1382. Xshort    movecost[MAPX][MAPY];
  1383. Xlong    startgold=0;
  1384. X
  1385. X/*offset of upper left hand corner*/
  1386. Xshort    xoffset=0,yoffset=0;
  1387. X/*current cursor postion (relative to 00 in upper corner)*/
  1388. X/*    position is 2*x,y*/
  1389. Xshort    xcurs=0,ycurs=0;
  1390. X/*redraw map in this turn if redraw is a 1*/
  1391. Xshort    redraw=TRUE;
  1392. X/*1 if you have quit*/
  1393. Xint done=FALSE;
  1394. X/*display state*/
  1395. Xshort    hilmode=HI_OWN;
  1396. Xshort    dismode=DI_DESI;
  1397. Xshort    selector=0;  /*selector (y vbl) for which army/navy... is "picked"*/
  1398. Xshort    pager=0;     /*pager for selector 0,1,2,3*/
  1399. X/* nation id of owner*/
  1400. Xshort    country=0;
  1401. Xint owneruid;
  1402. X
  1403. XFILE *fexe, *fopen();
  1404. X
  1405. Xint
  1406. Xmain(argc,argv)
  1407. Xint argc;
  1408. Xchar **argv;
  1409. X{
  1410. X    int geteuid(), getuid(), setuid();
  1411. X    register int i;
  1412. X    char *name;
  1413. X    void srand();
  1414. X    int getopt();
  1415. X    char passwd[20];
  1416. X    long time();
  1417. X    char string[80];
  1418. X    extern char *optarg;
  1419. X    char defaultdir[256];
  1420. X    struct passwd *getpwnam();
  1421. X    int sflag=0;
  1422. X
  1423. X    owneruid=getuid();
  1424. X    srand((unsigned) time((long *) 0));
  1425. X    strcpy(defaultdir, DEFAULTDIR);
  1426. X    name = string;
  1427. X    *name = 0;
  1428. X
  1429. X    /* process the command line arguments */
  1430. X    while((i=getopt(argc,argv,"hn:d:s"))!=EOF) switch(i){
  1431. X    /* process the command line arguments */
  1432. X    case 'h': /* execute help program*/
  1433. X        if (chdir(defaultdir)) {
  1434. X            printf("unable to change dir to %s\n",defaultdir);
  1435. X            exit(FAIL);
  1436. X        }
  1437. X        initscr();
  1438. X        savetty();
  1439. X        noecho();
  1440. X        crmode();            /* cbreak mode */
  1441. X        signal(SIGINT,SIG_IGN);        /* disable keyboard signals */
  1442. X        signal(SIGQUIT,SIG_IGN);
  1443. X        help();
  1444. X        endwin();
  1445. X        putchar('\n');
  1446. X        exit(SUCCESS);
  1447. X    case 'd':
  1448. X        strcpy(defaultdir, optarg);
  1449. X        break;
  1450. X    case 'n':
  1451. X        strcpy(name, optarg);
  1452. X        break;
  1453. X        case 's': /*print the score*/
  1454. X        sflag++;
  1455. X        break;
  1456. X    case '?': /*  print out command line arguments */
  1457. X        printf("Command line format: %s [-hs -d DIR -nNAT]\n",argv[0]);
  1458. X        printf("\t-n NAT   play as nation NAT\n");
  1459. X        printf("\t-h       print help text\n");
  1460. X        printf("\t-d DIR   to use play different game\n");
  1461. X        printf("\t-s       print scores\n");
  1462. X        exit(SUCCESS);
  1463. X    };
  1464. X
  1465. X    /* now that we have parsed the args, we can got to the
  1466. X     * dir where the files are kept and do some work.
  1467. X     */
  1468. X    if (chdir(defaultdir)) {
  1469. X        printf("unable to change dir to %s\n",defaultdir);
  1470. X        exit(FAIL);
  1471. X    }
  1472. X
  1473. X    /* read data*/
  1474. X    readdata();
  1475. X    verifydata( __FILE__, __LINE__ );
  1476. X
  1477. X    if(sflag){
  1478. X        printscore();
  1479. X        exit(SUCCESS);
  1480. X    }
  1481. X
  1482. X        /*
  1483. X         *  Set the real uid to the effective.  This will avoid a
  1484. X         *  number of problems involving file protection if the
  1485. X         *  executable is setuid.
  1486. X         */
  1487. X        (void) setuid (geteuid ()) ;
  1488. X
  1489. X    /* must be a normal interactive game */
  1490. X    armornvy=AORN;
  1491. X
  1492. X    /* identify the player and the country he represents */
  1493. X
  1494. X    /* get nation name either from command line or by asking
  1495. X         *     if you fail will give you the name of administrator of game
  1496. X         */
  1497. X
  1498. X    /* verify existence of nation*/
  1499. X    printf("conquer %s: Copyright (c) 1988 by Edward M Barlow\n",VERSION);
  1500. X    if (*name == 0) {
  1501. X        printf("what nation would you like to be:");
  1502. X        scanf("%s",name);
  1503. X    }
  1504. X#ifdef OGOD
  1505. X        if(strcmp(name,"god")==0) {
  1506. X        if ( owneruid != (getpwnam(LOGIN))->pw_uid ){
  1507. X        printf("sorry -- you can not login as god\n");
  1508. X        printf("you need to be logged in as %s\n",LOGIN);
  1509. X        exit(FAIL);
  1510. X    }
  1511. X        strcpy(name,"unowned");
  1512. X    }
  1513. X#else
  1514. X    if(strcmp(name,"god")==0) strcpy(name,"unowned");
  1515. X#endif OGOD
  1516. X    country=(-1);
  1517. X    for(i=0;i<NTOTAL;i++)
  1518. X        if(strcmp(name,ntn[i].name)==0) country=i;
  1519. X
  1520. X    if(country==(-1)) {
  1521. X        printf("name not found\n");
  1522. X        printf("\nfor rules type <conquer -h>");
  1523. X        printf("\nfor more information please contact %s\n",OWNER);
  1524. X        return;
  1525. X    }
  1526. X
  1527. X    /*get encrypted password*/
  1528. X    strcpy(passwd,crypt(getpass("\nwhat is your nations password:"),SALT));
  1529. X    if((strncmp(passwd,ntn[country].passwd,PASSLTH)!=0)
  1530. X    &&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
  1531. X        strcpy(passwd,crypt(getpass("\nerror: reenter your nations password:"),SALT));
  1532. X        if((strncmp(passwd,ntn[country].passwd,PASSLTH)!=0)
  1533. X        &&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
  1534. X            printf("\nsorry:");
  1535. X            printf("\nfor rules type <conquer -h>");
  1536. X            printf("\nfor more information on the system please contact %s\n",OWNER);
  1537. X            exit(FAIL);
  1538. X        }
  1539. X    }
  1540. X
  1541. X    /* check if user is super-user nation[0] */
  1542. X    /*    else setup cursor to capitol*/
  1543. X    if(country==0) {
  1544. X        printf("welcome super user\n");
  1545. X        xcurs=1;
  1546. X        xoffset=0;
  1547. X        ycurs=1;
  1548. X        yoffset=0;
  1549. X    } else {
  1550. X        printf("\nloading nation %s\n",ntn[country].name);
  1551. X        if (ntn[country].active==0) {
  1552. X            printf("\nSorry, for some reason, your country no longer exists.");
  1553. X            printf("\nIf there is a problem, please contact %s.\n",OWNER);
  1554. X            exit(FAIL);
  1555. X        }
  1556. X        if(aretheyon()==1) {
  1557. X            printf("\nSorry, country is already logged in.\n");
  1558. X            printf("Please try again later.\n");
  1559. X            exit(FAIL);
  1560. X        }
  1561. X        execute();
  1562. X        if(ntn[country].capx>15) {
  1563. X            xcurs=15;
  1564. X            xoffset= (ntn[country].capx-15);
  1565. X        }
  1566. X        else {
  1567. X            xcurs= ntn[country].capx;
  1568. X            xoffset= 0;
  1569. X        }
  1570. X        if(ntn[country].capy>10) {
  1571. X            ycurs=10;
  1572. X            yoffset= (ntn[country].capy-10);
  1573. X        }
  1574. X        else {
  1575. X            yoffset= 0;
  1576. X            ycurs= ntn[country].capy;
  1577. X        }
  1578. X    }
  1579. X
  1580. X    updmove(ntn[country].race,country);
  1581. X
  1582. X    /* open output for future printing*/
  1583. X    {
  1584. X        char filename[80];
  1585. X        sprintf(filename,"%s%d",exefile,country);
  1586. X        if ((fexe=fopen(filename,"a"))==NULL) {
  1587. X            beep();
  1588. X            printf("error opening %s\n",filename);
  1589. X            unlink(fison);
  1590. X            exit(FAIL);
  1591. X        }
  1592. X    }
  1593. X
  1594. X    /* SET UP THE SCREEN */
  1595. X    printf("about to set up the screen");
  1596. X    initscr();
  1597. X    crmode();            /* cbreak mode */
  1598. X    signal(SIGINT,SIG_IGN);        /* disable keyboard signals */
  1599. X    signal(SIGQUIT,SIG_IGN);
  1600. X        signal(SIGHUP,hangup);        /* must catch hangups */
  1601. X
  1602. X    prep(country);
  1603. X    noecho();
  1604. X
  1605. X    /*main while routine*/
  1606. X    done=FALSE;
  1607. X    while (done==FALSE)
  1608. X    {
  1609. X        /* check if cursor is out of bounds*/
  1610. X        coffmap();
  1611. X        /*get commands, make moves and input command*/
  1612. X        parse();
  1613. X    }
  1614. X
  1615. X    if(country==0) writedata();
  1616. X    else {
  1617. X    fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n",
  1618. X        XNAGOLD ,country,ntn[country].tgold,"null");
  1619. X    fprintf(fexe,"L_NIRON\t%d \t%d \t%ld \t0 \t0 \t%s\n",
  1620. X        XNAIRON ,country,ntn[country].tiron,"null");
  1621. X    fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n",
  1622. X        XNARGOLD ,country,ntn[country].jewels,"null");
  1623. X    }
  1624. X    /*done so quit*/
  1625. X    unlink(fison);
  1626. X    clear();
  1627. X    printw("quitting\n");
  1628. X    refresh();
  1629. X    nocrmode();
  1630. X    endwin();
  1631. X    fclose(fexe);
  1632. X    exit(SUCCESS);
  1633. X}
  1634. X
  1635. X/*make the bottom of the screen*/
  1636. Xint
  1637. Xmakebottom()
  1638. X{
  1639. X    move(LINES-4,0);
  1640. X    clrtoeol();
  1641. X    mvprintw(LINES-3,0,"Conquer: %s",VERSION);
  1642. X    clrtoeol();
  1643. X    mvaddstr(LINES-1,0,"  type ? for help");
  1644. X    clrtoeol();
  1645. X    mvaddstr(LINES-2,0,"  type Q to quit");
  1646. X    clrtoeol();
  1647. X    if(country==0) mvaddstr(LINES-3,COLS-20,"nation..GOD  ");
  1648. X    else {
  1649. X        mvprintw(LINES-3,COLS-20,"nation...%s",ntn[country].name);
  1650. X        mvprintw(LINES-2,COLS-20,"treasury.%ld",ntn[country].tgold);
  1651. X        mvprintw(LINES-1,COLS-20,"score....%ld",ntn[country].score);
  1652. X    }
  1653. X}
  1654. X
  1655. X/* parse */
  1656. Xint
  1657. Xparse()
  1658. X{
  1659. X    register int i;
  1660. X    char name[20];
  1661. X    char passwd[12];
  1662. X    int ocountry;
  1663. X
  1664. X    switch(getch()) {
  1665. X    case EXT_CMD:    /* extended command */
  1666. X            ext_cmd();
  1667. X        break;
  1668. X    case ' ':    /*redraw the screen*/
  1669. X        redraw=TRUE;
  1670. X        break;
  1671. X    case 'a':    /*army report*/
  1672. X        redraw=TRUE;
  1673. X        armyrpt(0);
  1674. X        break;
  1675. X    case 'A':    /*adjust army*/
  1676. X        adjarm(-1);
  1677. X        makebottom();
  1678. X        break;
  1679. X    case '1':
  1680. X    case 'b':    /*move south west*/
  1681. X        pager=0;
  1682. X        selector=0;
  1683. X        xcurs--;
  1684. X        ycurs++;
  1685. X        break;
  1686. X    case 'B':    /*budget*/
  1687. X        redraw=TRUE;
  1688. X        budget();
  1689. X        break;
  1690. X    case 'c':    /*change nation stats*/
  1691. X        redraw=TRUE;
  1692. X        change();
  1693. X        break;
  1694. X    case 'C':    /*construct*/
  1695. X        construct();
  1696. X        makebottom();
  1697. X        break;
  1698. X    case 'd':    /*change display*/
  1699. X        newdisplay();
  1700. X        break;
  1701. X    case 'D':    /*draft*/
  1702. X        draft();
  1703. X        makebottom();
  1704. X        break;
  1705. X    case 'f': /*report on ships and load/unload*/
  1706. X        redraw=TRUE;
  1707. X        fleetrpt();
  1708. X        break;
  1709. X    case 'F':    /*go to next army*/
  1710. X        navygoto();
  1711. X        break;
  1712. X    case 'g':    /*group report*/
  1713. X        redraw=TRUE;
  1714. X        armyrpt(1);
  1715. X        break;
  1716. X    case 'G':    /*go to next army*/
  1717. X        armygoto();
  1718. X        break;
  1719. X    case 'H':    /*scroll west*/
  1720. X        pager=0;
  1721. X        selector=0;
  1722. X        xcurs-=((COLS-22)/4);
  1723. X        break;
  1724. X    case '4':
  1725. X    case 'h':    /*move west*/
  1726. X        pager=0;
  1727. X        selector=0;
  1728. X        xcurs--;
  1729. X        break;
  1730. X    case 'J':    /*scroll down*/
  1731. X        pager=0;
  1732. X        selector=0;
  1733. X        ycurs+=((SCREEN_Y_SIZE)/2);
  1734. X        break;
  1735. X    case '2':
  1736. X    case 'j':    /*move down*/
  1737. X        pager=0;
  1738. X        selector=0;
  1739. X        ycurs++;
  1740. X        break;
  1741. X    case '8':
  1742. X    case 'k':    /*move up*/
  1743. X        pager=0;
  1744. X        selector=0;
  1745. X        ycurs--;
  1746. X        break;
  1747. X    case 'K':    /*scroll up*/
  1748. X        pager=0;
  1749. X        selector=0;
  1750. X        ycurs-=((SCREEN_Y_SIZE)/2);
  1751. X        break;
  1752. X    case '6':
  1753. X    case 'l':    /*move east*/
  1754. X        pager=0;
  1755. X        selector=0;
  1756. X        xcurs++;
  1757. X        break;
  1758. X    case 'L':    /*scroll east*/
  1759. X        pager=0;
  1760. X        selector=0;
  1761. X        xcurs+=((COLS-22)/4);
  1762. X        break;
  1763. X    case 'm':    /*move selected item to new x,y */
  1764. X        mymove();
  1765. X        makebottom();
  1766. X        prep(country);
  1767. X        pager=0;
  1768. X        selector=0;
  1769. X        break;
  1770. X    case 'M':    /*magic*/
  1771. X        redraw=TRUE;
  1772. X        domagic();
  1773. X        break;
  1774. X    case '3':
  1775. X    case 'n':    /*move south-east*/
  1776. X        pager=0;
  1777. X        selector=0;
  1778. X        ycurs++;
  1779. X        xcurs++;
  1780. X        break;
  1781. X    case 'N':    /*read newspaper */
  1782. X        redraw=TRUE;
  1783. X        newspaper();
  1784. X        break;
  1785. X    case 'p':    /*pick*/
  1786. X        selector+=2;
  1787. X        if(selector>=10) {
  1788. X            selector=0;
  1789. X            pager+=1;
  1790. X        }
  1791. X        /*current selected unit is selector/2+5*pager*/
  1792. X        if((selector/2)+(pager*5)>=units_in_sector(XREAL,YREAL,country)) {
  1793. X            pager=0;
  1794. X            selector=0;
  1795. X        }
  1796. X        break;
  1797. X    case 'P':    /*production*/
  1798. X        redraw=TRUE;
  1799. X        produce();
  1800. X        break;
  1801. X    case 'Q':    /*quit*/
  1802. X    case 'q':    /*quit*/
  1803. X        done=TRUE;
  1804. X        break;
  1805. X    case 'r':    /*redesignate*/
  1806. X        redesignate();
  1807. X        makemap();
  1808. X        makebottom();
  1809. X        break;
  1810. X        /*list*/
  1811. X    case 'R':    /*Read Messages*/
  1812. X        redraw=TRUE;
  1813. X        rmessage();
  1814. X        refresh();
  1815. X        break;
  1816. X    case 's':    /*score*/
  1817. X        redraw=TRUE;
  1818. X        showscore();
  1819. X        break;
  1820. X    case 'S':    /*diplomacy screens*/
  1821. X        diploscrn();
  1822. X        redraw=TRUE;
  1823. X        break;
  1824. X    case '9':
  1825. X    case 'u':    /*move north-east*/
  1826. X        pager=0;
  1827. X        selector=0;
  1828. X        ycurs--;
  1829. X        xcurs++;
  1830. X        break;
  1831. X        case 'U':    /* scroll north-east */
  1832. X        pager=0;
  1833. X        selector=0;
  1834. X        xcurs+=((COLS-22)/4);
  1835. X        ycurs-=((SCREEN_Y_SIZE)/2);
  1836. X        break;
  1837. X    case 'W':    /*message*/
  1838. X        redraw=TRUE;
  1839. X        wmessage();
  1840. X        break;
  1841. X    case '7':
  1842. X    case 'y':    /*move north-west*/
  1843. X        pager=0;
  1844. X        selector=0;
  1845. X        ycurs--;
  1846. X        xcurs--;
  1847. X        break;
  1848. X    case 'Y':    /* scroll north-west */
  1849. X        pager=0;
  1850. X        selector=0;
  1851. X        xcurs-=((COLS-22)/4);
  1852. X        ycurs-=((SCREEN_Y_SIZE)/2);
  1853. X        break;
  1854. X    case 'Z':    /*move civilians up to 2 spaces*/
  1855. X        redraw=TRUE;
  1856. X        moveciv();
  1857. X        break;
  1858. X    case 'z':    /*login as new user */
  1859. X#ifdef OGOD
  1860. X        if (owneruid != (getpwnam(LOGIN))->pw_uid) break;
  1861. X#endif
  1862. X        clear();
  1863. X        redraw=TRUE;
  1864. X        if(country != 0) {
  1865. X        fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n",
  1866. X            XNAGOLD ,country,ntn[country].tgold,"null");
  1867. X        fprintf(fexe,"L_NIRON\t%d \t%d \t%ld \t0 \t0 \t%s\n",
  1868. X            XNAIRON ,country,ntn[country].tiron,"null");
  1869. X        fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n",
  1870. X            XNARGOLD ,country,ntn[country].jewels,"null");
  1871. X        } else
  1872. X        mvaddstr(0,0,"SUPER-USER: YOUR CHANGES WILL NOT BE SAVED IF YOU DO THIS!!!");
  1873. X        standout();
  1874. X        mvaddstr(2,0,"change login to : ");
  1875. X        standend();
  1876. X        refresh();
  1877. X        get_nname(name);
  1878. X
  1879. X        ocountry=country;
  1880. X        country=(-1);
  1881. X        if(strcmp(name,"god")==0) country=0;
  1882. X        else for(i=1;i<NTOTAL;i++)
  1883. X            if((strcmp(name,ntn[i].name)==0)&&(ntn[i].active>=1))
  1884. X                country=i;
  1885. X
  1886. X        if(country==(-1)) {
  1887. X            errormsg("name not found");
  1888. X            country=ocountry;
  1889. X            break;
  1890. X        }
  1891. X        if(country==ocountry){
  1892. X            errormsg("same country");
  1893. X            break;
  1894. X        }
  1895. X
  1896. X        /*get password*/
  1897. X        mvaddstr(2,0,"what is your nations password:");
  1898. X        refresh();
  1899. X        getstr(passwd);
  1900. X        strcpy(name,crypt(passwd,SALT));
  1901. X
  1902. X        if((strncmp(name,ntn[country].passwd,PASSLTH)!=0)
  1903. X        &&(strncmp(name,ntn[0].passwd,PASSLTH)!=0)){
  1904. X            errormsg("sorry:  password invalid");
  1905. X            country=ocountry;
  1906. X            break;
  1907. X        }
  1908. X        unlink(fison);
  1909. X        if(aretheyon()==1) {
  1910. X            errormsg("sorry:  country is already logged in.");
  1911. X            refresh();
  1912. X            country=ocountry;
  1913. X            break;
  1914. X        }
  1915. X
  1916. X        fclose(fexe);
  1917. X        /* open output for future printing*/
  1918. X         sprintf(name,"%s%d",exefile,country);
  1919. X         if ((fexe=fopen(name,"a"))==NULL) {
  1920. X            beep();
  1921. X            printf("error opening %s\n",name);
  1922. X            unlink(fison);
  1923. X            exit(FAIL);
  1924. X         }
  1925. X
  1926. X        printf("\n");
  1927. X        readdata();
  1928. X        execute();
  1929. X
  1930. X        updmove(ntn[country].race,country);
  1931. X        /*go to that nations capitol*/
  1932. X        if(country!=0) {
  1933. X            if(ntn[country].capx>15) {
  1934. X                xcurs=15;
  1935. X                xoffset= (ntn[country].capx-15);
  1936. X            }
  1937. X            else {
  1938. X                xcurs= ntn[country].capx;
  1939. X                xoffset= 0;
  1940. X            }
  1941. X            if(ntn[country].capy>10) {
  1942. X                ycurs=10;
  1943. X                yoffset= (ntn[country].capy-10);
  1944. X            }
  1945. X            else {
  1946. X                yoffset= 0;
  1947. X                ycurs= ntn[country].capy;
  1948. X            }
  1949. X        }
  1950. X        break;
  1951. X    case '?':    /*display help screen*/
  1952. X        redraw=TRUE;
  1953. X        help();
  1954. X        break;
  1955. X    default:
  1956. X        beep();
  1957. X    }
  1958. X}
  1959. X
  1960. Xvoid
  1961. Xmakeside()
  1962. X{
  1963. X    int i;
  1964. X    int armbonus=0;
  1965. X    int found=0,nvyfnd=0;
  1966. X    int enemy;
  1967. X    int y;
  1968. X    short armynum;
  1969. X    short nvynum;
  1970. X    int count;
  1971. X    int nfound=0;
  1972. X    register struct s_sector    *sptr = &sct[XREAL][YREAL];
  1973. X
  1974. X    /*clear side if you cant see it as you are out of bounds*/
  1975. X    if(inch()==' ') {
  1976. X        for(i=0;i<LINES-3;i++){
  1977. X            move(i,COLS-21);
  1978. X            clrtoeol();
  1979. X        }
  1980. X        return;
  1981. X    }
  1982. X
  1983. X    /*clear top right hand side each new sector*/
  1984. X    for(count=0;count<11;count++){
  1985. X        move(count,COLS-21);
  1986. X        clrtoeol();
  1987. X    }
  1988. X
  1989. X    /*check for your armies*/
  1990. X    count=units_in_sector(XREAL,YREAL,country);
  1991. X    if(pager*5>count) pager=0;
  1992. X
  1993. X    /*first army found is #0*/
  1994. X    /*show armies / navies in range pager*5 to pager*5 + 4*/
  1995. X    /*so if pager=0 show 0 to 4, pager=2 show 10 to 14*/
  1996. X    /*current selected unit is selector/2+5*pager*/
  1997. X
  1998. X    if(count>(5+(pager*5))) mvaddstr(10,COLS-20,"MORE...");
  1999. X
  2000. X    nfound=0;
  2001. X    for(armynum=0;armynum<MAXARM;armynum++){
  2002. X        if((ASOLD>0)&&(AXLOC==XREAL)&&(AYLOC==YREAL)) {
  2003. X            if((nfound>=pager*5)&&(nfound<=4+(pager*5))) {
  2004. X                /*print that army to nfound%5*/
  2005. X                mvaddch((nfound%5)*2,COLS-21,'>');
  2006. X                if(selector==(nfound%5)*2) standout();
  2007. X                /*the mv,for gets the highlighting pretty*/
  2008. X                move((nfound%5)*2,COLS-10);
  2009. X                for(i=0;i<9;i++) addch(' ');
  2010. X
  2011. X                mvprintw((nfound%5)*2,COLS-20,"army %d: %d (%s)",armynum,ASOLD,*(shunittype+(ATYPE%100)));
  2012. X                /*the mv,for gets the highlighting pretty*/
  2013. X                move((nfound%5)*2+1,COLS-10);
  2014. X                for(i=0;i<9;i++) addch(' ');
  2015. X
  2016. X                mvprintw((nfound%5)*2+1,COLS-20," mv:%d st:%s",AMOVE,*(soldname+ASTAT));
  2017. X                standend();
  2018. X            }
  2019. X            nfound++;
  2020. X        }
  2021. X        if((occ[XREAL][YREAL]!=0)
  2022. X        &&(occ[XREAL][YREAL]!=country)
  2023. X        &&((sptr->owner==country)||((ASOLD>0)&&(AXLOC<=XREAL+1)
  2024. X        &&(AXLOC>=XREAL-1)&&(AYLOC<=YREAL+1)&&(AYLOC>=YREAL-1))))
  2025. X            found=1;
  2026. X    }
  2027. X
  2028. X    if(nfound<4+(pager*5)) for(nvynum=0;nvynum<MAXNAVY;nvynum++){
  2029. X        if(((NWAR+NMER)!=0)&&(NXLOC==XREAL)&&(NYLOC==YREAL)) {
  2030. X            if((nfound>=pager*5)&&(nfound<=4+(pager*5))) {
  2031. X                /*print a navy*/
  2032. X                mvaddch((nfound%5)*2,COLS-21,'>');
  2033. X                if(selector==(nfound%5)*2) standout();
  2034. X                mvprintw((nfound%5)*2,COLS-20,"navy %d: move %d",nvynum,NMOVE);
  2035. X                mvprintw((nfound%5)*2+1,COLS-20," war:%d mer:%d",NWAR,NMER);
  2036. X                standend();
  2037. X            }
  2038. X            nfound++;
  2039. X        }
  2040. X        if((occ[XREAL][YREAL]!=0)&&(occ[XREAL][YREAL]!=country)
  2041. X        &&(sptr->altitude==WATER)
  2042. X        &&(NWAR+NMER>0)&&(NXLOC<=XREAL+1)&&(NXLOC>=XREAL-1)
  2043. X        &&(NYLOC<=YREAL+1)&&(NYLOC>=YREAL-1))
  2044. X            nvyfnd=1;
  2045. X    }
  2046. X
  2047. X    count=0;
  2048. X    if(found==1) for(i=0;i<NTOTAL;i++) {
  2049. X        if( !magic(i,HIDDEN) || country == 0 ){
  2050. X            enemy=0;
  2051. X            for(armynum=0;armynum<MAXARM;armynum++){
  2052. X                if((i!=country)
  2053. X                &&(ntn[i].arm[armynum].xloc==XREAL)
  2054. X                &&(ntn[i].arm[armynum].yloc==YREAL)
  2055. X                &&(ntn[i].arm[armynum].sold>0))
  2056. X                enemy+=ntn[i].arm[armynum].sold;
  2057. X            }
  2058. X            if(enemy>0) {
  2059. X                if((magic(country,NINJA)==1) || country == 0 )
  2060. X                    mvprintw(nfound*2+count,COLS-20,"%s: %d men  ",ntn[i].name,enemy);
  2061. X                else if(magic(i,THE_VOID)==1){
  2062. X                mvprintw(nfound*2+count,COLS-20,"%s: ?? men  ",ntn[i].name);
  2063. X                clrtoeol();
  2064. X                }
  2065. X                else mvprintw(nfound*2+count,COLS-20,"%s: %d men  ",ntn[i].name,(enemy*(rand()%60+70)/100));
  2066. X                count++;
  2067. X            }
  2068. X        }
  2069. X    }
  2070. X    if(nvyfnd==1) for(i=0;i<NTOTAL;i++) {
  2071. X        if( magic(i,HIDDEN)!=1 || country == 0 )
  2072. X        for(nvynum=0;nvynum<MAXNAVY;nvynum++)
  2073. X        if((ntn[i].arm[nvynum].xloc==XREAL)
  2074. X        &&(ntn[i].arm[nvynum].yloc==YREAL)
  2075. X        &&(ntn[i].arm[nvynum].sold>0)){
  2076. X            if((magic(country,NINJA)==1) || country == 0 ){
  2077. X                mvprintw(nfound*2+count,COLS-20,"%s: %d ships  ",
  2078. X                ntn[i].name,ntn[i].nvy[nvynum].warships+ntn[i].nvy[nvynum].merchant);
  2079. X            }
  2080. X            else if(magic(i,THE_VOID)==1){
  2081. X            mvprintw(nfound*2+count,COLS-20,"%s: ?? ships",ntn[i].name);
  2082. X            clrtoeol();
  2083. X            }
  2084. X            else mvprintw(nfound*2+count,COLS-20,"%s: %d ships  ",
  2085. X            ntn[i].name,(ntn[i].nvy[nvynum].warships+ntn[i].nvy[nvynum].merchant)*(rand()%6+7)/10);
  2086. X            count++;
  2087. X        }
  2088. X    }
  2089. X
  2090. X    standend();
  2091. X    mvprintw(11,COLS-20,"x is %d  ",XREAL);
  2092. X    mvprintw(11,COLS-11,"y is %d  ",YREAL);
  2093. X
  2094. X    if((country!=0)&&(sptr->altitude==WATER)){
  2095. X        for(y=12;y<=20;y++) mvaddstr(y,COLS-20,"                    ");
  2096. X        mvaddstr(14,COLS-9,"WATER");
  2097. X    }
  2098. X    else {
  2099. X    if((country!=0)&&(country!=sptr->owner)
  2100. X    &&(magic(sptr->owner,THE_VOID)==1)){
  2101. X        for(y=13;y<=20;y++) mvaddstr(y,COLS-20,"                    ");
  2102. X    }
  2103. X    else {
  2104. X
  2105. X        for(y=13;y<=14;y++) mvaddstr(y,COLS-20,"                    ");
  2106. X
  2107. X        for(i=0;i<=7;i++)
  2108. X            if(sptr->designation==*(des+i)){
  2109. X            mvprintw(13,COLS-20,"%s",*(desname+i));
  2110. X            clrtoeol();
  2111. X            }
  2112. X
  2113. X        if((sptr->owner==country)||(country==0))
  2114. X        mvprintw(15,COLS-20,"people: %6d",sptr->people);
  2115. X        else
  2116. X        mvprintw(15,COLS-20,"people: %6d",sptr->people*(rand()%60+70)/100);
  2117. X
  2118. X        if((sptr->owner==country)
  2119. X        ||(sptr->owner==0)
  2120. X        ||(sptr->owner>=MAXNTN)){
  2121. X            mvprintw(17,COLS-20,"gold is:   %3d",sptr->gold);
  2122. X            mvprintw(18,COLS-20,"iron is:   %3d",sptr->iron);
  2123. X            if(sptr->fortress == 0) {
  2124. X            mvaddstr(19,COLS-20,"               ");
  2125. X            } else {
  2126. X            if(sptr->designation==DCASTLE)
  2127. X                armbonus=5 * sptr->fortress;
  2128. X            else
  2129. X            if(sptr->designation==DCITY){
  2130. X                if(magic(country,ARCHITECT)==1){
  2131. X                armbonus+=10+16 * sptr->fortress;
  2132. X                }
  2133. X                else armbonus+=10+8 * sptr->fortress;
  2134. X            }
  2135. X            else if(sptr->designation==DCAPITOL){
  2136. X                if(magic(country,ARCHITECT)==1){
  2137. X                armbonus+=20+20 * sptr->fortress;
  2138. X                }
  2139. X                else armbonus+=20+10 * sptr->fortress;
  2140. X            }
  2141. X            if(armbonus>0)
  2142. X            mvprintw(19,COLS-20,"fortress: +%2d%%",armbonus);
  2143. X            }
  2144. X        }
  2145. X        else {
  2146. X        for(y=17;y<=19;y++) mvaddstr(y,COLS-20,"                    ");
  2147. X        }
  2148. X    }
  2149. X
  2150. X    standout();
  2151. X    if(sptr->owner==0) mvaddstr(12,COLS-20,"unowned");
  2152. X    else mvprintw(12,COLS-20,"owner: %s",ntn[sptr->owner].name);
  2153. X    standend();
  2154. X    clrtoeol();
  2155. X
  2156. X    for(i=0;i<=10;i++)
  2157. X        if(sptr->vegetation==*(veg+i))
  2158. X        mvprintw(13,COLS-9,"%s",*(vegname+i));
  2159. X
  2160. X    if(tofood(sptr->vegetation,country) != 0)
  2161. X        mvprintw(13,COLS-1,"%d",tofood(sptr->vegetation,country));
  2162. X
  2163. X    if(sptr->owner!=0) for(i=1;i<=8;i++)
  2164. X        if(ntn[sptr->owner].race==*(races+i)[0]){
  2165. X        mvprintw(14,COLS-20,"%s",*(races+i));
  2166. X        clrtoeol();
  2167. X        }
  2168. X
  2169. X    for(i=0;(*(ele+i) != '0');i++)
  2170. X        if( sptr->altitude == *(ele+i) ){
  2171. X            mvprintw(14,COLS-9,"%s",*(elename+i));
  2172. X            break;
  2173. X        }
  2174. X    }
  2175. X
  2176. X    if(movecost[XREAL][YREAL]<0)
  2177. X    mvaddstr(16,COLS-20,"YOU CAN'T ENTER HERE");
  2178. X    else
  2179. X    mvprintw(16,COLS-20,"move cost:  %2d      ",movecost[XREAL][YREAL]);
  2180. X}
  2181. X
  2182. X/* returns 1 if they are on, else 0 */
  2183. Xint
  2184. Xaretheyon()
  2185. X{
  2186. X    FILE *fon;
  2187. X    /* set up a detection feature for when a country */
  2188. X    /* is logged on... to prevent multiple logins    */
  2189. X    sprintf(fison,"%s%d",isonfile,country);
  2190. X    if((fon=fopen(fison,"r"))==NULL) {
  2191. X        fon=fopen(fison,"w");
  2192. X        fprintf(fon,"Arg!");
  2193. X        fclose(fon);
  2194. X        return(0);
  2195. X    } else {
  2196. X        return(1);
  2197. X    }
  2198. X}
  2199. END_OF_main.c
  2200. if test 19741 -ne `wc -c <main.c`; then
  2201.     echo shar: \"main.c\" unpacked with wrong size!
  2202. fi
  2203. # end of overwriting check
  2204. fi
  2205. echo shar: End of archive 6 \(of 8\).
  2206. cp /dev/null ark6isdone
  2207. MISSING=""
  2208. for I in 1 2 3 4 5 6 7 8 ; do
  2209.     if test ! -f ark${I}isdone ; then
  2210.     MISSING="${MISSING} ${I}"
  2211.     fi
  2212. done
  2213. if test "${MISSING}" = "" ; then
  2214.     echo You have unpacked all 8 archives.
  2215.     rm -f ark[1-9]isdone
  2216. else
  2217.     echo You still need to unpack the following archives:
  2218.     echo "        " ${MISSING}
  2219. fi
  2220. ##  End of shell archive.
  2221. exit 0
  2222.